package com.lock;

import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.vm.VM;

/**
 * @author: csh
 * @Date: 2022/11/20 11:18
 * @Description:同步锁测试
 */
public class SynchronizedLock {

    public synchronized static  void method(){
        System.out.println("锁的是对象");
    }

    public  void method1(){
        synchronized (this){
            System.out.println("锁是代码块！");
        }
    }

    public synchronized void method2(){
        System.out.println("锁的是方法！");
    }

    public static void main(String[] args) {
        System.out.println("测试");
        System.out.println(VM.current().details());
        SynchronizedLock synchronizedLock = new SynchronizedLock();
        System.out.println(ClassLayout.parseInstance(synchronizedLock).toPrintable());
    }
}
